<template>
	<view class="page">
		<view class="form-content">
			<u-form :model="formData" ref="uForm" class="uForm" label-position="top">
				<u-form-item prop="needamount" label="期望金额（万元）" label-width="auto">
					<u-input v-model="formData.needAmount" type="number" placeholder="请输入期望金额" />
					<view slot="right">万元</view>
				</u-form-item>
				<u-form-item prop="needdate" label="期望放款时间" label-width="auto">
					<dateTime v-model="formData.needDate" :showLabel="false" :showArrow="false" :disabled="true"
						className="new-date-picker" placeholder="请选择放款时间" jnpfKey="date"></dateTime>
				</u-form-item>
				<u-form-item prop="needdesc" label="需求描述" label-width="auto">
					<u-input type="textarea" v-model="formData.needDesc" placeholder="请输入需求描述" />
				</u-form-item>
			</u-form>
		</view>
		<view class="save-bottom">
			<view class="fixed-btn save-padding">
				<u-button type="primary" shape="circle" @click="onSubmit">确定</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import dateTime from '@/components/dateTime/dateTime.vue'
	import config from '@/common/js/config.js'

	import jnpf from '@/common/js/jnpf.js'
	export default {
		components: {
			dateTime
		},
		name: 'customerBase',
		data() {
			return {
				formData: {
					needDate: undefined,
					needAmount: undefined,
					needDesc: undefined,
					customerId: undefined,
					userId: undefined,
					userName: undefined,
				}
			}
		},
		onLoad(options) {
			if (options.id) {
				this.formData.customerId = options.id
			}


			this.userProvider = uni.getStorageSync(config.Global.cache + '_UserProvider');
			this.formData.userId = this.userProvider.id;
			this.formData.userName = this.userProvider.realName;
		},
		methods: {
			/* 表单提交 */
			onSubmit() {
				let url = "/api/Jiushi/Customerneed";
				let method = "POST";

				this.$helper.ajax({
					url: url,
					method: method,
					contentType: "application/json",
					data: this.formData,
					success: res => {
						this.$helper.msg(res.data.msg, 'success');
						uni.navigateTo({
							url: '/pagesJiushi/demand/list/mydemandlist'
						})
					}
				});
			},
		}
	}
</script>

<style>

</style>